package com.ctbri.containerindepth;

import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;

import com.ctbri.util.Countries;

public class Ex2 {

	public static void main(String[] args) {
		TreeMap<String, String> map = new TreeMap<>(Countries.capitals());
		TreeSet<String> set = new TreeSet<>(Countries.names());
		String b = null;
		for(String k : map.keySet()) {
			if(k.startsWith("B")) {
				b = k;
				break;
			}
		}
		Map<String, String> aMap = map.headMap(b);
		Set<String> aSet = set.headSet(b);
		System.out.println("aMap = " + aMap);
		System.out.println("aSet = " + aSet);
	}

}
